import React from 'react'
import './style.css'
import { AppWrapper } from './style'
import { connect } from 'react-redux'
import { Link, useRoutes } from 'react-router-dom'
import routes from './router'

export function App (props) {
  return (
    <AppWrapper>
      <div className='layout-header'>
        <span>IT云课堂平台</span>
        <Link to="/">首页</Link>
        <Link to="/course">在线课程</Link>
      </div>
      <div className='layout-main'>
        { useRoutes(routes) }
      </div>
    </AppWrapper>
  )
}

const mapStateToProps = (state) => ({
  category: state.video.category
})
const mapDispatchToProps = (dispatch) => ({
})

export default connect(mapStateToProps, mapDispatchToProps)(App)